package com.yhn.init.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import com.yhn.init.common.BaseResponse;
import com.yhn.init.common.ResultUtils;
import com.yhn.init.model.dto.purchase.PurchaseAddRequest;
import com.yhn.init.service.PurchaseService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 采购清单控制类
 *
 * @author yhn
 * @version 1.0
 * @description
 * @date 2024/3/22 10:41
 */
@RestController
@RequestMapping("/user")
public class PurchaseController {
    @Resource
    private PurchaseService purchaseService;

    @PostMapping("/save")
    @SaCheckPermission(value = {"/furniture/purchase/add", "root"}, mode = SaMode.OR)
    public BaseResponse<Long> save(@RequestBody @Valid PurchaseAddRequest purchaseAddRequest) {

        return ResultUtils.success(purchaseService.addPurchase(purchaseAddRequest));
    }


}
